﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace School
{
    public class Student
    {
        private string name;
        private int facultyNumber;

        public Student(string name, int facultyNumber)
        {
            ValidateName(name);
            ValidateFacultyNumber(facultyNumber);
            this.name = name;
            this.facultyNumber = facultyNumber;
        }

        private void ValidateName(string name)
        {
            if (name == "")
            {
                throw new ArgumentException("The name should not be an empty string");
            }
        }

        private void ValidateFacultyNumber(int facultyNumber)
        {
            if (facultyNumber < 10000 || facultyNumber > 99999)
            {
                throw new ArgumentOutOfRangeException("Faculty number should be between 10000 and 99999");
            }
        }

        public string Name
        {
            get
            {
                return name;
            }
        }

        public int FacultyNumber
        {
            get
            {
                return facultyNumber;
            }
        }

        public override bool Equals(object obj)
        {
            Student other = obj as Student;
            if (other == null)
            {
                return false;
            }
            return this.facultyNumber == other.facultyNumber;
        }

        public override int GetHashCode()
        {
            return facultyNumber;
        }
    }
}
